package com.steamedfish.auctioncloudprocess.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTimeUtils {

    public static Date StringToDate(String dateString) throws ParseException {
        SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = sf1.parse(dateString);
        return date;
    }

    public static Date preTime(Date predate, Integer timeStamp) {
        Date resultDate = new Date(predate.getTime() - timeStamp);
        return resultDate;
    }

    public static Date afterTime(Date predate, Integer timeStamp) {
        Date resultDate = new Date(predate.getTime() + timeStamp);
        return resultDate;
    }
}